package com.hmkj.core.service.simulation;

import com.hmkj.core.eolinker.models.ModelRealTime;
import com.hmkj.core.model.BuyModel;
import com.hmkj.core.po.simulation.OrderSimulation;
import com.hmkj.core.po.user.User;
import com.hmkj.core.service.base.GenericService;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 模拟订单业务相关Service接口<br>
 *
 * @ClassName: OrderSimulationService
 * @author eproo
 * @date   2018-07-09 02:35:10
 */
public interface OrderSimulationService extends GenericService<Integer, OrderSimulation> {

    /**
     * 统计模拟用户总盈亏 已結算的單子
     * @param userId 用户ID
     * @return 总盈亏
     */
    BigDecimal getProfitCountByUser(int userId);

    /**
     * 模拟点买
     * @param user
     * @param total
     * @param modelRealTime
     * @param use
     * @param model
     * @param totalNumber
     */
    void buyOrderForSimulation(User user, BigDecimal total, ModelRealTime modelRealTime, double use, BuyModel model,double totalNumber) throws Exception;

    void buyOrderSimulation(User user, ModelRealTime modelRealTime, BuyModel model);
    /**
     * 模拟平仓
     * @param order
     * @param last_price
     */
    void doOrderSimulateSell(OrderSimulation order, String last_price);

    /**
     * 查询某一时间段模拟结算订单
     * @param param
     * @return
     */
    List<OrderSimulation> selectOrderSimulateForTime(Map<String,Object> param);


    /**
     * 查询某一时间段盈利的模拟结算订单
     * @param param
     * @return
     */
    List<OrderSimulation> selectProfitOrderSimulateForTime(Map<String,Object> param);

    /**
     * 月排名查询
     * @return
     */
    List<OrderSimulation> selectSimulationRank(String today);

    /**
     * 修改止损
     * @param orderSimulation
     * @param stopLosePrice
     * @param needDeposit
     * @param lastPrice
     * @throws Exception
     */
    void doAlterStopLoss(OrderSimulation orderSimulation, BigDecimal stopLosePrice,BigDecimal needDeposit,BigDecimal lastPrice) throws Exception;
}
